import VueRouter  from "vue-router";
import Vue from 'vue'
import Discover from '../components/Discover.vue'
import My from '../components/My.vue'
import friends from '../components/friends.vue'
import tolist from '../components/tolist.vue'
import playlist from '../components/playlist.vue'

//注册一个路由
Vue.use(VueRouter)

//创建一个路由对象

// const router = new VueRouter({
//     //指定hash属性和组件的对应关系
//     routes:[
//         {path:'/discover',component:Discover},
//         {path:'/my',component:My},
//         {path:'/friends',component:friends}
//     ]
// })

export default new VueRouter({
    //指定hash属性和组件的对应关系
    routes:[
        {path:'/',redirect:'/discover'},//重定向
        {path:'/discover',component:Discover,children:[
            {path:"tolist",component:tolist},
            {path:"playlist",component:playlist}
        ]},
        {path:'/my',component:My},
        {path:'/friends',component:friends},
        // // 第一种方式
        // {path:'/discover/tolist',component:tolist},
        // {path:'/discover/playlist',component:playlist},
    ]
})
